package com.iflytek.cosmo.ocr.common.exception;

import com.iflytek.cosmo.ocr.common.enums.ResultCodeEnum;

/**
 * @author <a href=mailto:ktyi@iflytek.com>伊开堂</a>
 * @date 2020/4/21 16:50
 */
public class CommonException extends RuntimeException {

    private ResultCodeEnum code;

    private String message;

    public CommonException() {
    }

    public CommonException(Throwable cause) {
        super(cause);
    }

    public CommonException(ResultCodeEnum code) {
        this.code = code;
        this.message = code.getDesc();
    }

    public CommonException(ResultCodeEnum code, Throwable cause) {
        super(cause);
        this.code = code;
        this.message = code.getDesc();
    }

    public ResultCodeEnum getCode() {
        return code;
    }

    public void setCode(ResultCodeEnum code) {
        this.code = code;
    }

    @Override
    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }
}
